<html>
<head><meta charset="utf-8"><title>refactoring `hir::Place` and `hir_id` · t-compiler/wg-rfc-2229 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/index.html">t-compiler/wg-rfc-2229</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html">refactoring `hir::Place` and `hir_id`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="199132593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199132593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199132593">(May 29 2020 at 09:32)</a>:</h4>
<p>Regarding the <code>hir_id</code> field of <code>hir::Place</code></p>



<a name="199132601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199132601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199132601">(May 29 2020 at 09:33)</a>:</h4>
<p>I should probably review the code and where it is used</p>



<a name="199132815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199132815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199132815">(May 29 2020 at 09:35)</a>:</h4>
<p>but my belief is that it is used for error reporting</p>



<a name="199132867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199132867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199132867">(May 29 2020 at 09:36)</a>:</h4>
<p>I would probably remove it from <code>hir::Place</code> but add a <code>hir::PlaceWithHirId</code> sort of structure, perhaps with a better name =)</p>



<a name="199133776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199133776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199133776">(May 29 2020 at 09:48)</a>:</h4>
<p>the other field that this applies to is the <code>span</code> field</p>



<a name="199133816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199133816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199133816">(May 29 2020 at 09:48)</a>:</h4>
<p>these are cases where I wish we had a good find-all-references impl :)</p>



<a name="199133859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199133859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199133859">(May 29 2020 at 09:49)</a>:</h4>
<p>I guess I would say <code>hir::PlaceInstance</code> or something might be a name for this wrapper structure? or <code>PlaceReference</code>? basically it's <em>some particular reference to a place</em>?</p>



<a name="199133901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199133901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199133901">(May 29 2020 at 09:49)</a>:</h4>
<p>so the idea would be to have</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">PlaceRef</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">hir_id</span>: <span class="nc">HirId</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">span</span>: <span class="nc">Span</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">place</span>: <span class="nc">Place</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="199133921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199133921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199133921">(May 29 2020 at 09:49)</a>:</h4>
<p>and replace various uses of <code>Place</code> with <code>PlaceRef</code></p>



<a name="199134026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199134026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199134026">(May 29 2020 at 09:50)</a>:</h4>
<p>(the easier way to refactor might be to just rename <code>Place</code> to <code>PlaceRef</code>, fix everything, and then extract out the <code>Place</code> struct again)</p>



<a name="199142944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199142944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199142944">(May 29 2020 at 11:47)</a>:</h4>
<p>When would we ever use <code>Place</code> on is own?</p>



<a name="199166714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199166714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199166714">(May 29 2020 at 15:06)</a>:</h4>
<p>When we list out the set of things that a closure captures</p>



<a name="199166751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199166751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199166751">(May 29 2020 at 15:06)</a>:</h4>
<p>it seems like that is not tied to any specific usage</p>



<a name="199166775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199166775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199166775">(May 29 2020 at 15:06)</a>:</h4>
<p>though I guess it's not <em>harmful</em> to tie it to a specific usage necessarily, might even help with diagnostics</p>



<a name="199166818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199166818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199166818">(May 29 2020 at 15:07)</a>:</h4>
<p>i.e., it sort of captures that extra information that we like to keep to help explain to people <em>why</em> a given path is captured</p>



<a name="199198370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199198370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199198370">(May 29 2020 at 19:09)</a>:</h4>
<p>still, my feeling was that having <code>hir_id</code> and the like would ultimately complicate things</p>



<a name="199198392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199198392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199198392">(May 29 2020 at 19:09)</a>:</h4>
<p>it feels like what we want is a notion of "canonical place" that we could (e.g.) compare for equality and the like</p>



<a name="199198403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199198403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199198403">(May 29 2020 at 19:09)</a>:</h4>
<p>and then (separately) some hir-id or span to cite as "why it is captured"</p>



<a name="199268504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199268504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199268504">(May 30 2020 at 18:01)</a>:</h4>
<p>I'll take a look over how <code>HirPlace</code>s are used over the next week.</p>



<a name="199268508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199268508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199268508">(May 30 2020 at 18:01)</a>:</h4>
<p>When I was discussing projects with @Centril, <a href="https://github.com/rust-lang/rfcs/pull/1650">https://github.com/rust-lang/rfcs/pull/1650</a> and <a href="https://github.com/Centril/rfcs/blob/rfc/uniform-generic-bounds/text/0000-uniform-generic-bounds.md">https://github.com/Centril/rfcs/blob/rfc/uniform-generic-bounds/text/0000-uniform-generic-bounds.md</a> came up as well. I know these aren't accepted RFCs and I don't think they are going to affected by this refactor directly, but I'm not very familiar with the Rust codebase and thought I should bring these up.</p>



<a name="199274634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199274634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199274634">(May 30 2020 at 20:28)</a>:</h4>
<p>I don't think that they're relevant to this.</p>



<a name="199653238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199653238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199653238">(Jun 03 2020 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  outside of typechk and mir lowering, Place seems to be only be used in clippy and <br>
(here is how we got to this: <a href="https://github.com/sexxi-goose/rust/issues/14#issuecomment-638374305">https://github.com/sexxi-goose/rust/issues/14#issuecomment-638374305</a>)</p>
<div class="codehilite"><pre><span></span><code>librustc_mir_build/build/expr/as_place.rs
69:    crate fn as_place&lt;M&gt;(&amp;mut self, mut block: BasicBlock, expr: M) -&gt; BlockAnd&lt;Place&lt;&#39;tcx&gt;&gt;

librustc_mir_build/build/expr/into.rs
398:                debug_assert!(Category::of(&amp;expr.kind) == Some(Category::Place));
406:                debug_assert!(Category::of(&amp;expr.kind) == Some(Category::Place));
415:                debug_assert!(Category::of(&amp;expr.kind) == Some(Category::Place));

tools/clippy/clippy_lints/src/escape.rs
9:use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase};

tools/clippy/clippy_lints/src/loops.rs
31:use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase};

tools/clippy/clippy_lints/src/utils/usage.rs
11:use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase};
</code></pre></div>



<a name="199653858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199653858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199653858">(Jun 03 2020 at 17:57)</a>:</h4>
<p>Only the uses in Clippy are of  the HIR <code>Place</code>.</p>



<a name="199654824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199654824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199654824">(Jun 03 2020 at 18:05)</a>:</h4>
<p>I was assuming that Category::Place in mir_build was to indentify lowering HirPlace to MirPlace, because that needs to happen somewhere</p>



<a name="199655319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199655319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199655319">(Jun 03 2020 at 18:07)</a>:</h4>
<p>In the HIR that's being lowered everything is still an <code>hir::Expr</code>. <code>Place</code> is only used for some analysis passes in typeck.</p>



<a name="199655438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199655438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199655438">(Jun 03 2020 at 18:08)</a>:</h4>
<p>I see, thank you</p>



<a name="199657144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199657144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199657144">(Jun 03 2020 at 18:22)</a>:</h4>
<p>OK, good to know.</p>



<a name="199657456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199657456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199657456">(Jun 03 2020 at 18:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> what did you think about my comments about separating the <code>hir_id</code> field from <code>Place</code>?</p>



<a name="199657463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199657463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199657463">(Jun 03 2020 at 18:25)</a>:</h4>
<p>i.e., do you think it makes sense to try and do that?</p>



<a name="199658657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199658657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199658657">(Jun 03 2020 at 18:35)</a>:</h4>
<p>Perhaps. I guess I would work out what the code needs before doing the refactoring. I don't really see having <code>PartialEq</code> helping much because there's still some redundancy in the <code>Place</code> representation (inference variables, different normalization).</p>



<a name="199658810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199658810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199658810">(Jun 03 2020 at 18:36)</a>:</h4>
<p>It could be nice conceptually.</p>



<a name="199664596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199664596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199664596">(Jun 03 2020 at 19:25)</a>:</h4>
<p>Yeah, I think it's as much a matter of conceptually isolating them as anything else, good point that PartialEq isn't likely to be literally very helpful without further changes</p>



<a name="199664613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199664613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199664613">(Jun 03 2020 at 19:25)</a>:</h4>
<p>/me grumbles about normalization</p>



<a name="199695036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199695036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199695036">(Jun 04 2020 at 00:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116118">Matthew Jasper</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60/near/199658657">said</a>:</p>
<blockquote>
<p>Perhaps. I guess I would work out what the code needs before doing the refactoring. I don't really see having <code>PartialEq</code> helping much because there's still some redundancy in the <code>Place</code> representation (inference variables, different normalization).</p>
</blockquote>
<p>Can you elaborate a bit more on what <code>PartialEq</code> is and what you mean by normalizations and where might be some good reading material about it?</p>



<a name="199784311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199784311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199784311">(Jun 04 2020 at 17:48)</a>:</h4>
<p><code>PartialEq</code> is <a href="https://doc.rust-lang.org/std/cmp/trait.PartialEq.html">https://doc.rust-lang.org/std/cmp/trait.PartialEq.html</a><br>
By normalization I'm referring to how <code>&lt;std::slice::iter::Iter&lt;'a, T&gt; as Iterator&gt;::Item</code> and <code>&amp;'a T</code> are the different representations of the same type. I couldn't find anything particularly helpful explaining this for the compiler.</p>



<a name="199833420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199833420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199833420">(Jun 05 2020 at 03:44)</a>:</h4>
<p>Is there any part of rustc that currently deals with normalizing exprs to minimal form? Can we get this information from the type checker?</p>



<a name="199833570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199833570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199833570">(Jun 05 2020 at 03:49)</a>:</h4>
<p>Which part of <code>Place</code>s would require type normalization? Though I'm wondering if projections are normalized?</p>
<div class="codehilite"><pre><span></span><code>fn y(x: &amp;String) {
    println!(&quot;{}&quot;,x);
}

fn main() {
    let x = String::from(&quot;z&quot;);

    y(&amp;(*(&amp;x)));
}
</code></pre></div>


<p>where <code>(&amp;(*(&amp;x)))</code> can just be <code>&amp;x</code></p>



<a name="199836346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199836346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199836346">(Jun 05 2020 at 05:00)</a>:</h4>
<p>(deleted)</p>



<a name="199876929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199876929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199876929">(Jun 05 2020 at 13:38)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> so there are a few distinct concepts that have to be separated here</p>



<a name="199876940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199876940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199876940">(Jun 05 2020 at 13:38)</a>:</h4>
<p>what <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> was referring to is more about <em>types</em></p>



<a name="199876944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199876944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199876944">(Jun 05 2020 at 13:38)</a>:</h4>
<p>not <em>expressions</em></p>



<a name="199876993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199876993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199876993">(Jun 05 2020 at 13:38)</a>:</h4>
<p>in particular, HIR places (and MIR places...) embed in some places type information, and that type information can be expressed in various ways that are semantically equivalent but are represented differently</p>



<a name="199877002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877002">(Jun 05 2020 at 13:39)</a>:</h4>
<p>associated types are one possible example etc</p>



<a name="199877009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877009">(Jun 05 2020 at 13:39)</a>:</h4>
<p>inference variables are another</p>



<a name="199877048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877048">(Jun 05 2020 at 13:39)</a>:</h4>
<p>I don't think we really have to worry about these details yet, they may become relevant but not for some time</p>



<a name="199877064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877064">(Jun 05 2020 at 13:39)</a>:</h4>
<p>that said, there is some documentation I think in the rustc-dev-guide, let me look</p>



<a name="199877103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877103">(Jun 05 2020 at 13:39)</a>:</h4>
<p>anyway, as far as "normalizing" expressions, that is in fact the role of the HIR place itself, or at least part of it</p>



<a name="199877190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877190">(Jun 05 2020 at 13:40)</a>:</h4>
<p>your example didn't quite make sense, because it included <code>&amp;</code> expressions -- we are mainly considered with a subset of expressions that we call "place expressions", though I think the term "path" is also rather useful</p>



<a name="199877217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877217">(Jun 05 2020 at 13:40)</a>:</h4>
<p>these are basically expressions that name "places" in memory -- so e.g. a local variable <code>x</code> names a stack slot,</p>



<a name="199877227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877227">(Jun 05 2020 at 13:40)</a>:</h4>
<p>or a field <code>x.f</code> names a field of some struct that lives somewhere</p>



<a name="199877337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877337">(Jun 05 2020 at 13:41)</a>:</h4>
<p>the full form is something like</p>
<div class="codehilite"><pre><span></span><code>Expr = local variable | Expr . Projection
Projection = field name | &#39;[&#39; expr &#39;]&#39; | deref
</code></pre></div>



<a name="199877344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877344">(Jun 05 2020 at 13:41)</a>:</h4>
<p>so e.g. <code>(*x).f</code> is a place expression</p>



<a name="199877413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877413">(Jun 05 2020 at 13:42)</a>:</h4>
<p>that indicates the point in memory you reach by starting with the pointer <code>x</code>, going to the memory it refers to, and finding the field <code>f</code> there</p>



<a name="199877500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877500">(Jun 05 2020 at 13:43)</a>:</h4>
<p>note that this place expression is "normalized" in that the source code the user wrote was probably <code>x.f</code>and the compiler inserted the <code>*</code> to make <code>(*x).f</code></p>



<a name="199877518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877518">(Jun 05 2020 at 13:43)</a>:</h4>
<p>this happens as part of the <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/expr_use_visitor/struct.ExprUseVisitor.html"><code>ExprUseVisitor</code></a>, we won't have to reproduce that</p>



<a name="199877799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199877799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199877799">(Jun 05 2020 at 13:45)</a>:</h4>
<p>what I've been talking about in this refactoring is separating out the conceptual <em>place expression</em> (<code>(*x).f</code>) from some particular expression in the source code from which it was created (the <code>x.f</code>, which is identified by the <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/expr_use_visitor/struct.Place.html#structfield.hir_id"><code>hir_id</code></a> and <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/expr_use_visitor/struct.Place.html#structfield.span"><code>Span</code></a>)</p>



<a name="199909023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199909023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199909023">(Jun 05 2020 at 17:28)</a>:</h4>
<p>I was mostly curious where we used types in Place and also curious if someone wrote that code, will the projections be able to normalize the repeated reference and dereference.</p>
<p>So from what I can see projections doesn't really store field information, just "Other" right now (<a href="https://github.com/sexxi-goose/rust/blob/master/src/librustc_typeck/mem_categorization.rs#L362">https://github.com/sexxi-goose/rust/blob/master/src/librustc_typeck/mem_categorization.rs#L362</a>), and I also previously mentioned that we need to do the categorization for upvars as well (not hard given we already have functions that are going to be doing the heavy lifting)</p>



<a name="199911586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199911586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199911586">(Jun 05 2020 at 17:52)</a>:</h4>
<p>Yes, we are going to have to extend <code>Place</code> to be more complete</p>



<a name="199911598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199911598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199911598">(Jun 05 2020 at 17:52)</a>:</h4>
<p>The current HIR place was designed with limited purposes in mind</p>



<a name="199911606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199911606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199911606">(Jun 05 2020 at 17:52)</a>:</h4>
<p>The <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Place.html">MIR place</a> is complete</p>



<a name="199999424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/199999424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#199999424">(Jun 07 2020 at 00:12)</a>:</h4>
<p>So is the plan to start with something like what you have suggested and then move on to bringing things from <code>librustc_mir_build/build/expr</code>?</p>



<a name="200132983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200132983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200132983">(Jun 08 2020 at 17:51)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> I guess we have to settle into a canonical plan</p>



<a name="200133001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200133001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200133001">(Jun 08 2020 at 17:51)</a>:</h4>
<p>I think probably a good place to start with HIR Place would be to start making it more precise</p>



<a name="200133011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200133011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200133011">(Jun 08 2020 at 17:51)</a>:</h4>
<p>that's more important, I think, than the <code>HirId</code> question</p>



<a name="200133020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200133020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200133020">(Jun 08 2020 at 17:51)</a>:</h4>
<p>although that's also a good refactoring</p>



<a name="200133077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200133077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200133077">(Jun 08 2020 at 17:52)</a>:</h4>
<p>I'm trying to remember if we have a kind of "canonical place" to trackl the plans etc</p>



<a name="200246698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200246698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200246698">(Jun 09 2020 at 15:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> I was looking at the list of places</p>



<a name="200246707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200246707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200246707">(Jun 09 2020 at 15:32)</a>:</h4>
<p>or rather projections</p>



<a name="200246766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200246766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200246766">(Jun 09 2020 at 15:32)</a>:</h4>
<p>I think we probably don't intend to capture individual elements from slices</p>



<a name="200246907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200246907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200246907">(Jun 09 2020 at 15:33)</a>:</h4>
<p>similarly, the way that HIR Place is setup now, I guess that it doesn't retain the "type" information for intermediate fields and the like, not sure if this is a problem</p>



<a name="200246928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200246928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200246928">(Jun 09 2020 at 15:33)</a>:</h4>
<p>It's probably not what I would expect.</p>



<a name="200246979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200246979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200246979">(Jun 09 2020 at 15:33)</a>:</h4>
<p>I think we should start by not capturing slice elements, anyway</p>



<a name="200247027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247027">(Jun 09 2020 at 15:34)</a>:</h4>
<p>probably just fields/derefs</p>



<a name="200247066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247066">(Jun 09 2020 at 15:34)</a>:</h4>
<p>basically I'm thinking about what the projection structure should look like when we're done</p>



<a name="200247152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247152">(Jun 09 2020 at 15:34)</a>:</h4>
<p>probably it looks more-or-less the same as MIR indexing, but I guess we don't need as much detail about indices</p>



<a name="200247162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247162">(Jun 09 2020 at 15:35)</a>:</h4>
<p>e.g., just "index" suffices</p>



<a name="200247172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247172">(Jun 09 2020 at 15:35)</a>:</h4>
<p>(this is why I brought it up)</p>



<a name="200247188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247188">(Jun 09 2020 at 15:35)</a>:</h4>
<p>not sure about downcast</p>



<a name="200247505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247505">(Jun 09 2020 at 15:36)</a>:</h4>
<p>I was considering combining it into <code>Field(u32, VariantIdx)</code></p>



<a name="200247732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247732">(Jun 09 2020 at 15:38)</a>:</h4>
<p>what is the <code>u32</code></p>



<a name="200247769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247769">(Jun 09 2020 at 15:38)</a>:</h4>
<p>oh, I see</p>



<a name="200247801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247801">(Jun 09 2020 at 15:38)</a>:</h4>
<p>The field's index, we don't have a general newtype for it.</p>



<a name="200247913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200247913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200247913">(Jun 09 2020 at 15:39)</a>:</h4>
<p>MIR has <code>Field</code>.</p>



<a name="200248262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248262">(Jun 09 2020 at 15:41)</a>:</h4>
<p>we could move that our from MIR but it's a relatively minor point</p>



<a name="200248308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248308">(Jun 09 2020 at 15:42)</a>:</h4>
<p>what I was wondering about was whether we want to include a <code>Ty</code></p>



<a name="200248319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248319">(Jun 09 2020 at 15:42)</a>:</h4>
<p>seems like probably yes</p>



<a name="200248347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248347">(Jun 09 2020 at 15:42)</a>:</h4>
<p>if we're going to want to (for example) "intersect" places</p>



<a name="200248378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248378">(Jun 09 2020 at 15:42)</a>:</h4>
<p>but I'm not actually sure</p>



<a name="200248398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248398">(Jun 09 2020 at 15:42)</a>:</h4>
<p>i.e., we may never really need to know all the details about the types</p>



<a name="200248411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248411">(Jun 09 2020 at 15:42)</a>:</h4>
<p>but it seems like a good guess that we will</p>



<a name="200248417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248417">(Jun 09 2020 at 15:42)</a>:</h4>
<p>Probably, and remove existing type from deref because it's now easy to compute.</p>



<a name="200248429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248429">(Jun 09 2020 at 15:42)</a>:</h4>
<p>right</p>



<a name="200248436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248436">(Jun 09 2020 at 15:42)</a>:</h4>
<p>I suspect that we will.</p>



<a name="200248462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248462">(Jun 09 2020 at 15:43)</a>:</h4>
<p>me too, especially when we are analyzing what place gets captured</p>



<a name="200248578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248578">(Jun 09 2020 at 15:43)</a>:</h4>
<p>And I guess remove the final type of the place and add one for the base.</p>



<a name="200248580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248580">(Jun 09 2020 at 15:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116118">Matthew Jasper</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60/near/200248417">said</a>:</p>
<blockquote>
<p>Probably, and remove existing type from deref because it's now easy to compute.</p>
</blockquote>
<p>is this the type that is <em>being</em> derefernced?</p>



<a name="200248600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248600">(Jun 09 2020 at 15:43)</a>:</h4>
<p>Yes, it's the pointer type.</p>



<a name="200248674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248674">(Jun 09 2020 at 15:44)</a>:</h4>
<p>the base type is easily computed from context, usually, but maybe it's convenient to include</p>



<a name="200248778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200248778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200248778">(Jun 09 2020 at 15:45)</a>:</h4>
<p>seems like we should sketch out what the final struct looks like, we're getting close, and then we can better figure out the steps to take to get there</p>



<a name="200249624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200249624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200249624">(Jun 09 2020 at 15:50)</a>:</h4>
<p>I guess what we currently have is:</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">PlaceAndHirId</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="c1">// You had a better name for this</span>
<span class="w">    </span><span class="n">place</span>: <span class="nc">Place</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">hir_id</span>: <span class="nc">HirId</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="c1">// Maybe no Span, since they&#39;re being removed from the Hir</span>
<span class="p">}</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Place</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">base</span>: <span class="nc">PlaceBase</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">projections</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="n">Projection</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Projection</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">ty</span>: <span class="nc">Ty</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">kind</span>: <span class="nc">ProjectionKind</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">enum</span> <span class="nc">ProjectionKind</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Deref</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">Field</span><span class="p">(</span><span class="n">Field</span><span class="p">,</span><span class="w"> </span><span class="n">VariantIdx</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="n">Index</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">Subslice</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="200251480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200251480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200251480">(Jun 09 2020 at 16:01)</a>:</h4>
<p>Yeah. I guess the main question is whether the base needs a ty, but I think probably not</p>



<a name="200251518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200251518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200251518">(Jun 09 2020 at 16:01)</a>:</h4>
<p>I'm going to copy that into a note somewhere in the repo</p>



<a name="200251543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200251543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200251543">(Jun 09 2020 at 16:01)</a>:</h4>
<p>PS I'm liking this "repo to make plans about a major change" :)</p>



<a name="200252344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200252344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200252344">(Jun 09 2020 at 16:06)</a>:</h4>
<p>Just an FYI we currently use span to keep track of liveness (assuming that means lifetimes): <a href="https://github.com/sexxi-goose/rust/blob/master/src/librustc_passes/liveness.rs#L481">https://github.com/sexxi-goose/rust/blob/master/src/librustc_passes/liveness.rs#L481</a></p>



<a name="200252461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200252461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200252461">(Jun 09 2020 at 16:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> <a href="https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md">https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md</a></p>



<a name="200252471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200252471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200252471">(Jun 09 2020 at 16:07)</a>:</h4>
<p>feel free to edit or review :)</p>



<a name="200252508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200252508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200252508">(Jun 09 2020 at 16:07)</a>:</h4>
<p>I added some comments and changed the name from <code>PlaceAndHirId</code> to <code>PlaceReference</code></p>



<a name="200252524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200252524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200252524">(Jun 09 2020 at 16:07)</a>:</h4>
<p>but I don't really care, maybe that's less clear</p>



<a name="200252970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200252970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200252970">(Jun 09 2020 at 16:10)</a>:</h4>
<p>actually I like the <code>WithHirId</code> better I think</p>



<a name="200253327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200253327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200253327">(Jun 09 2020 at 16:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60/near/200252344">said</a>:</p>
<blockquote>
<p>Just an FYI we currently use span to keep track of liveness (assuming that means lifetimes): <a href="https://github.com/sexxi-goose/rust/blob/master/src/librustc_passes/liveness.rs#L481">https://github.com/sexxi-goose/rust/blob/master/src/librustc_passes/liveness.rs#L481</a></p>
</blockquote>
<p>I think for now we can keep the span</p>



<a name="200253340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200253340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200253340">(Jun 09 2020 at 16:12)</a>:</h4>
<p>it may get factored out</p>



<a name="200253361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200253361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200253361">(Jun 09 2020 at 16:12)</a>:</h4>
<p>relatively minor thing</p>



<a name="200284932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200284932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200284932">(Jun 09 2020 at 20:22)</a>:</h4>
<p>I think we should refactor for the closure map to use Place before we do sexxi-goose#4 (using closure_captures instead upvars_mentioned) mostly because we need span for <code>rust_passes/liveness.rs</code>? This also allows for the span PR to get merged.</p>
<p>Also can you link to the PR to track removing span from rust_passes?</p>



<a name="200289252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200289252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200289252">(Jun 09 2020 at 20:56)</a>:</h4>
<p>That's potentially a good idea, yeah</p>



<a name="200289291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200289291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200289291">(Jun 09 2020 at 20:57)</a>:</h4>
<p>rather than refactor to some intermediate thing that includes a span, as we discussed, just refactor to a HIR place?</p>



<a name="200292591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200292591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200292591">(Jun 09 2020 at 21:23)</a>:</h4>
<p>Do we then remove lines like these that require span?<br>
<a href="https://github.com/rust-lang/rust/compare/598c363c0c53edd20e00702d4e6185bdd99b1a0c...sexxi-goose:change_upvars_to_typeck_tables_of#diff-ee896dcafc5548c2174f63be76fb0822R490">https://github.com/rust-lang/rust/compare/598c363c0c53edd20e00702d4e6185bdd99b1a0c...sexxi-goose:change_upvars_to_typeck_tables_of#diff-ee896dcafc5548c2174f63be76fb0822R490</a></p>



<a name="200304670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200304670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200304670">(Jun 09 2020 at 23:37)</a>:</h4>
<p>^ this would depend on if we the refactor before the span PR is merged</p>



<a name="200473572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200473572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200473572">(Jun 10 2020 at 20:41)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> I'm a bit confused by the question I guess</p>



<a name="200473648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200473648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200473648">(Jun 10 2020 at 20:42)</a>:</h4>
<p>but I think we will always want to have a span (or a <code>hir_id</code>, from which we derive a span) associated with the captured place</p>



<a name="200475234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200475234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200475234">(Jun 10 2020 at 20:55)</a>:</h4>
<p>I guess main question is how long do you think the PR to remove span from Hir will take? </p>
<p>If we are done the initial refactor to split Place into Place and PlaceHirId before the span PR is merged, and we want to start using Place for closure captures, do we just ignore the lines that require span? </p>
<p>I think some of the work to use Place in Captures can be done in parallel to making projections more precise</p>



<a name="200492345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200492345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200492345">(Jun 10 2020 at 23:46)</a>:</h4>
<p>Also I forgot to bring this up yesterday, do we want to call Place with hir_id PlaceReference, it might be confusing provided <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.PlaceRef.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.PlaceRef.html</a> exists.</p>



<a name="200511064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200511064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200511064">(Jun 11 2020 at 07:02)</a>:</h4>
<p>You don't need to wait for spans to be removed from HIR. The spans can already be accessed from HirIds using existing API <code>tcx.hir().span(hir_id)</code>.</p>



<a name="200539815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/200539815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#200539815">(Jun 11 2020 at 12:56)</a>:</h4>
<p>Awesome, thank you!</p>



<a name="201682365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201682365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201682365">(Jun 23 2020 at 02:20)</a>:</h4>
<p>So in the doc here: <a href="https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md">https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md</a></p>
<p>We don't have type information within Place itself. Unless I'm missing something it seems if we call <code>cat_res</code> (eg: <a href="https://github.com/rust-lang/rust/blob/cbf356a1a5677b1c073f09ba833d8247c7ed01aa/src/librustc_typeck/expr_use_visitor.rs#L518">expr_use_visitor</a>)we won't have any projetions and would loose the type information. </p>
<p>I think we should leave the type information of the overal/final access as is.</p>



<a name="201682619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201682619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201682619">(Jun 23 2020 at 02:27)</a>:</h4>
<p>Also the changes seem much simpler than we expected (<a href="https://github.com/rust-lang/rust/compare/master...sexxi-goose:projection-ty?expand=1">https://github.com/rust-lang/rust/compare/master...sexxi-goose:projection-ty?expand=1#</a>) </p>
<p>I think we should add test cases to ensure functional correctness, can you point us to some test cases that test typeinformation  and something that would be good examples to work from?</p>



<a name="201773644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201773644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201773644">(Jun 23 2020 at 19:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  for this one what are your thoughts</p>



<a name="201773930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201773930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201773930">(Jun 23 2020 at 19:52)</a>:</h4>
<p>looing now</p>



<a name="201774005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774005">(Jun 23 2020 at 19:53)</a>:</h4>
<p>I'm not sure I understand the first part</p>



<a name="201774113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774113">(Jun 23 2020 at 19:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60/near/201682619">said</a>:</p>
<blockquote>
<p>Also the changes seem much simpler than we expected (<a href="https://github.com/rust-lang/rust/compare/master...sexxi-goose:projection-ty?expand=1">https://github.com/rust-lang/rust/compare/master...sexxi-goose:projection-ty?expand=1#</a>) </p>
</blockquote>
<p>well I think you're missing a bit of cleanup here</p>



<a name="201774155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774155">(Jun 23 2020 at 19:54)</a>:</h4>
<p>So in the document for the suggested Place refactoring, we don't store the type associated with the place anymore. </p>
<p>i.e. <a href="https://github.com/rust-lang/rust/compare/master...sexxi-goose:projection-ty?expand=1#diff-87528b3a624ad671b31f556cce5c612bL96">https://github.com/rust-lang/rust/compare/master...sexxi-goose:projection-ty?expand=1#diff-87528b3a624ad671b31f556cce5c612bL96</a></p>
<p>This line should go away</p>



<a name="201774165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774165">(Jun 23 2020 at 19:54)</a>:</h4>
<p>the <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/mem_categorization/enum.ProjectionKind.html#variant.Deref"><code>ProjectionKind::Deref</code></a> variant no longer needs a <code>Ty</code> I think</p>



<a name="201774221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774221">(Jun 23 2020 at 19:55)</a>:</h4>
<p>that <em>used</em> to be the "type of thing that was being dereferenced"</p>



<a name="201774240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774240">(Jun 23 2020 at 19:55)</a>:</h4>
<p>there is one other thing I think is missing</p>



<a name="201774284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774284">(Jun 23 2020 at 19:55)</a>:</h4>
<p>which is that there is a field <code>Place::ty</code></p>



<a name="201774305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774305">(Jun 23 2020 at 19:55)</a>:</h4>
<p>that stores the overall type of the place</p>



<a name="201774332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774332">(Jun 23 2020 at 19:55)</a>:</h4>
<p>But expr_use_visitor calls <code>cat_res</code>, which doesn't have any projections. If we remove <code>ty</code> from Place, then we loose type of the final access</p>



<a name="201774395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774395">(Jun 23 2020 at 19:56)</a>:</h4>
<p>no, we don't, it's just that if there are no projections, the type is the type of the <code>PlaceBase</code></p>



<a name="201774441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774441">(Jun 23 2020 at 19:56)</a>:</h4>
<p>I was about to say that we want to extend <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/expr_use_visitor/enum.PlaceBase.html"><code>PlaceBase</code></a> with a type too, I think</p>



<a name="201774478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774478">(Jun 23 2020 at 19:56)</a>:</h4>
<p>although in most cases it could be recomputed</p>



<a name="201774511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774511">(Jun 23 2020 at 19:57)</a>:</h4>
<p>but we'd have to extend it a bit -- notably <code>PlaceBase::Rvalue</code> needs a hir-id (what expression?) and <code>PlaceBase::StaticItem</code> needs a <code>DefId</code></p>



<a name="201774537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774537">(Jun 23 2020 at 19:57)</a>:</h4>
<p>maybe easier to just store it</p>



<a name="201774542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774542">(Jun 23 2020 at 19:57)</a>:</h4>
<p>I'm  little confused here</p>
<p>When I look at Projection::ty, is that the type after the projection is applied or before the projection is applied</p>



<a name="201774598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774598">(Jun 23 2020 at 19:57)</a>:</h4>
<p>I believ that is the final type of the place</p>



<a name="201774641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774641">(Jun 23 2020 at 19:58)</a>:</h4>
<p>after all projections (if any) have been applied</p>



<a name="201774681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774681">(Jun 23 2020 at 19:58)</a>:</h4>
<p>That would be Place::ty</p>



<a name="201774705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774705">(Jun 23 2020 at 19:58)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="sd">/// *Projections* select parts of the base expression; e.g.,</span>
<span class="sd">/// in the place expression `a.b.c`, `b` and `c` are projections</span>
<span class="k">struct</span> <span class="nc">Projection</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Type of the projection thus far.</span>
<span class="w">    </span><span class="n">ty</span>: <span class="nc">Ty</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>

<span class="w">    </span><span class="sd">///</span>
<span class="w">    </span><span class="n">kind</span>: <span class="nc">ProjectionKind</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="201774728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774728">(Jun 23 2020 at 19:58)</a>:</h4>
<p>I'm referring to the ty stored with each Projection</p>



<a name="201774853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774853">(Jun 23 2020 at 20:00)</a>:</h4>
<p>oh, I expect that to be the type <em>after</em> the projection is applied</p>



<a name="201774919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774919">(Jun 23 2020 at 20:00)</a>:</h4>
<p>(but we should definitely document it)</p>



<a name="201774934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774934">(Jun 23 2020 at 20:00)</a>:</h4>
<p>I suppose you could make it the type before as well, it'd just surprise me</p>



<a name="201774969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774969">(Jun 23 2020 at 20:00)</a>:</h4>
<p>and I'd give it a name like <code>before_ty</code> or something</p>



<a name="201774976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201774976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201774976">(Jun 23 2020 at 20:00)</a>:</h4>
<p>I think we can just document it a better</p>



<a name="201775037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775037">(Jun 23 2020 at 20:01)</a>:</h4>
<p>Currently we have it set as after the projection, the comment was a little confusing, so I wanted to check that</p>



<a name="201775332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775332">(Jun 23 2020 at 20:03)</a>:</h4>
<p>I find it more natural to have the type of the base and the type after each step</p>



<a name="201775356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775356">(Jun 23 2020 at 20:03)</a>:</h4>
<p>I think that is also what is in the MIR</p>



<a name="201775368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775368">(Jun 23 2020 at 20:03)</a>:</h4>
<p>so if we don't match that expectation I definitely think we should give it a distinctive name</p>



<a name="201775424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775424">(Jun 23 2020 at 20:04)</a>:</h4>
<p>Okay so we have Place::base_ty?</p>



<a name="201775451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775451">(Jun 23 2020 at 20:04)</a>:</h4>
<p>right -- that said, I can see the logic in doing it as the type <em>before</em></p>



<a name="201775468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775468">(Jun 23 2020 at 20:04)</a>:</h4>
<p>i.e., it might make some things easier</p>



<a name="201775495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775495">(Jun 23 2020 at 20:04)</a>:</h4>
<p>more-or-less the same, just depends on which you kind of want more often, idk</p>



<a name="201775524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775524">(Jun 23 2020 at 20:05)</a>:</h4>
<p>but overall I think matching MIR place is probably best</p>



<a name="201775609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775609">(Jun 23 2020 at 20:05)</a>:</h4>
<p>I think you're right, because projections are generated in the reverse order</p>



<a name="201775832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> azhng <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775832">(Jun 23 2020 at 20:07)</a>:</h4>
<p>so to conclude, we are going to</p>
<ol>
<li>Add Place::base_ty -- Type information of PlaceBase</li>
<li>Extending Projection with type information</li>
<li>Removing type from Place</li>
<li>Removing ProjectionKind::Deref 's type</li>
<li>Associating PlaceBase::Rvalue with hir_id ?</li>
</ol>



<a name="201775893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201775893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201775893">(Jun 23 2020 at 20:08)</a>:</h4>
<p>(deleted)</p>



<a name="201776281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776281">(Jun 23 2020 at 20:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60/near/201775609">said</a>:</p>
<blockquote>
<p>I think you're right, because projections are generated in the reverse order</p>
</blockquote>
<p>This feels wrong, trying to remeber where I read that projections are in reverse order. I know we call <code>.rev()</code> in clippy</p>



<a name="201776706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776706">(Jun 23 2020 at 20:16)</a>:</h4>
<p><span class="user-mention" data-user-id="282522">@azhng</span> you don't have to do step 5 necessarily</p>



<a name="201776732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776732">(Jun 23 2020 at 20:16)</a>:</h4>
<p>the reason to do that would have been to avoid storing <code>base_ty</code></p>



<a name="201776743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776743">(Jun 23 2020 at 20:16)</a>:</h4>
<p>i.e., we could compute the base ty by finding the type of the rvalue expression</p>



<a name="201776745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776745">(Jun 23 2020 at 20:16)</a>:</h4>
<p>but I think it's not worth it</p>



<a name="201776757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776757">(Jun 23 2020 at 20:16)</a>:</h4>
<p>or we can refactor later, either way</p>



<a name="201776765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776765">(Jun 23 2020 at 20:16)</a>:</h4>
<div class="codehilite"><pre><span></span><code>    /// Returns an iterator of the types that have to be dereferenced to access
    /// the `Place`.
    ///
    /// The types are in the reverse order that they are applied. So if
    /// `x: &amp;*const u32` and the `Place` is `**x`, then the types returned are
    ///`*const u32` then `&amp;*const u32`.
    crate fn deref_tys(&amp;self) -&gt; impl Iterator&lt;Item = Ty&lt;&#39;tcx&gt;&gt; + &#39;_ {
        self.projections.iter().rev().filter_map(|proj| {
            if let ProjectionKind::Deref(deref_ty) = proj.kind { Some(deref_ty) } else { None }
        })
    }
</code></pre></div>



<a name="201776773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776773">(Jun 23 2020 at 20:16)</a>:</h4>
<p>i.e., if we wind up needing the <code>hir_id</code> for some other purpose</p>



<a name="201776792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776792">(Jun 23 2020 at 20:17)</a>:</h4>
<p>I think projections are "in order" indeed</p>



<a name="201776812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776812">(Jun 23 2020 at 20:17)</a>:</h4>
<p>Okay yeah they seem to go innermost to outermost</p>



<a name="201776900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> azhng <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776900">(Jun 23 2020 at 20:18)</a>:</h4>
<p>Ok that makes sense. Thanks alot</p>



<a name="201776904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776904">(Jun 23 2020 at 20:18)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60/near/201775451">said</a>:</p>
<blockquote>
<p>right -- that said, I can see the logic in doing it as the type <em>before</em></p>
</blockquote>
<p>I'm a little confused as to what you meant by this</p>



<a name="201776929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776929">(Jun 23 2020 at 20:18)</a>:</h4>
<p>all I meant was this</p>



<a name="201776952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776952">(Jun 23 2020 at 20:18)</a>:</h4>
<p>some code might get more convenience that way</p>



<a name="201776998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201776998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201776998">(Jun 23 2020 at 20:19)</a>:</h4>
<p>e.g., if you are looking at a projection, it now becomes trivial to find the type of the place before that projection -- otherwise, you have to look at the projection before in the list, and if you're at the start of the list you have to get <code>base_ty</code>, it's a bit more logic</p>



<a name="201777013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201777013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201777013">(Jun 23 2020 at 20:19)</a>:</h4>
<p>otoh, of course, somethings are harder =)</p>



<a name="201777195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201777195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201777195">(Jun 23 2020 at 20:20)</a>:</h4>
<p>That makes sense. Thank you :)</p>



<a name="201778327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201778327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201778327">(Jun 23 2020 at 20:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Forgot to ask this, but are there any testcases for types that we can extend to check TypeInformation at each projection?</p>



<a name="201780804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201780804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201780804">(Jun 23 2020 at 20:48)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> no, there's not really a way to test that</p>



<a name="201780939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201780939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201780939">(Jun 23 2020 at 20:49)</a>:</h4>
<p>sometimes we will do things like setup a special rustc-specific attribute</p>



<a name="201780987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201780987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201780987">(Jun 23 2020 at 20:50)</a>:</h4>
<p>that dumps out special error messages with debug information</p>



<a name="201780993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201780993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201780993">(Jun 23 2020 at 20:50)</a>:</h4>
<p>I'm not sure it's worth it in this case</p>



<a name="201781021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201781021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201781021">(Jun 23 2020 at 20:50)</a>:</h4>
<p>usually that testing will happen as we develop the real feature (which would break if the info was wrong)</p>



<a name="201781128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201781128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201781128">(Jun 23 2020 at 20:51)</a>:</h4>
<p>that's fair, thanks</p>



<a name="201781155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201781155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201781155">(Jun 23 2020 at 20:51)</a>:</h4>
<p><span class="user-mention" data-user-id="282522">@azhng</span> fyi on the testing</p>



<a name="201781184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/201781184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> azhng <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#201781184">(Jun 23 2020 at 20:51)</a>:</h4>
<p>Sounds good !</p>



<a name="202017197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/202017197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#202017197">(Jun 25 2020 at 19:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Can you confirm <a href="https://github.com/rust-lang/project-rfc-2229/pull/13/files">https://github.com/rust-lang/project-rfc-2229/pull/13/files</a> this is what we expect? The PR for the change is almost ready to be pushed to rust-lang, and we just want to make sure the review goes smoothly</p>



<a name="202028599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring%20%60hir%3A%3APlace%60%20and%20%60hir_id%60/near/202028599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/refactoring.20.60hir.3A.3APlace.60.20and.20.60hir_id.60.html#202028599">(Jun 25 2020 at 21:39)</a>:</h4>
<p>Left a comment</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>